home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / fromNativePath.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.1 KB  |  63 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18.  
  19. //<doc>
  20.  
  21. //<name fromNativePath>
  22.  
  23. //<owner "Alias|Wavefront Unsupported">
  24.  
  25. //<synopsis>
  26.  
  27. //    string fromNativePath( string )
  28.  
  29. //<keywords>
  30.  
  31. //        MEL NT path file
  32.  
  33. //
  34.  
  35. //<description>
  36.  
  37. //        Convert from '/' to '\' path formats on NT, otherwise does nothing.
  38.  
  39. //        This proceedure can be used to try to unify path data to use the
  40.  
  41. //        forward slash character (a safer and more cross-platform way of
  42.  
  43. //        handling paths, since the forward slash is what Maya uses internally
  44.  
  45. //        to separate path names).
  46.  
  47. //
  48.  
  49. //<flags>
  50.  
  51. //      string $path
  52.  
  53. //          The path to be converted.
  54.  
  55. //
  56.  
  57. //<examples>
  58.  
  59. //        string $native = "c:\\examples\\scripts\\second\\city";
  60.  
  61. //        // Note the double backslashes used in input - in MEL, backslash is
  62.  
  63. //        // a special escape character and for it to be understood as the 
  64.  
  65. //        // backslash character, two backslashes must be used
  66.  
  67. //      string $path = fromNativePath( $native );
  68.  
  69. //        // Result: c:/examples/scripts/second/city // On NT
  70.  
  71. //
  72.  
  73. //<returns>
  74.  
  75. //      string: The converted path.
  76.  
  77. //</doc>
  78.  
  79. //
  80.  
  81. global proc string fromNativePath ( string $strFile )
  82.  
  83. {
  84.  
  85.     if( `about -nt` )
  86.  
  87.     {
  88.  
  89.         string $strNew;
  90.  
  91.         do
  92.  
  93.         {
  94.  
  95.             $strNew = $strFile;
  96.  
  97.             $strFile = substitute ("\\\\", $strNew, "/");
  98.  
  99.         }
  100.  
  101.         while ($strNew != $strFile);
  102.  
  103.     }
  104.  
  105.     return $strFile;
  106.  
  107. }
  108.  
  109.